#!/bin/bash

# 安装目录
INSTALL_DIR="/usr/local/bin"
BINARY_NAME="gitlog"

echo
echo "============================================================"
echo "Installing ${BINARY_NAME}..."
echo "============================================================"

# 安装二进制文件
echo "Installing binary..."
sudo cp "${0%/*}/${BINARY_NAME}" "$INSTALL_DIR/${BINARY_NAME}"
sudo chmod +x "$INSTALL_DIR/${BINARY_NAME}"
if [ $? -ne 0 ]; then
    echo "Failed to install the binary"
    exit 1
fi

# 创建符号链接（别名）
echo "Creating alias..."
sudo ln -sf "$INSTALL_DIR/${BINARY_NAME}" "$INSTALL_DIR/glb"

echo
echo "Installation completed!"
echo "You can now use 'gitlog' or 'glb' commands." 